/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Protection.impl;

import EA_Model.IEC61970.Domain.CurrentFlow;
import EA_Model.IEC61970.Domain.Seconds;

import EA_Model.IEC61970.Protection.CurrentRelay;
import EA_Model.IEC61970.Protection.ProtectionPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Current Relay</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.CurrentRelayImpl#getCurrentLimit1 <em>Current Limit1</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.CurrentRelayImpl#getCurrentLimit2 <em>Current Limit2</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.CurrentRelayImpl#getCurrentLimit3 <em>Current Limit3</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.CurrentRelayImpl#getInverseTimeFlag <em>Inverse Time Flag</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.CurrentRelayImpl#getTimeDelay1 <em>Time Delay1</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.CurrentRelayImpl#getTimeDelay2 <em>Time Delay2</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Protection.impl.CurrentRelayImpl#getTimeDelay3 <em>Time Delay3</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CurrentRelayImpl extends ProtectionEquipmentImpl implements CurrentRelay {
	/**
	 * The cached value of the '{@link #getCurrentLimit1() <em>Current Limit1</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCurrentLimit1()
	 * @generated
	 * @ordered
	 */
	protected CurrentFlow currentLimit1;

	/**
	 * The cached value of the '{@link #getCurrentLimit2() <em>Current Limit2</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCurrentLimit2()
	 * @generated
	 * @ordered
	 */
	protected CurrentFlow currentLimit2;

	/**
	 * The cached value of the '{@link #getCurrentLimit3() <em>Current Limit3</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCurrentLimit3()
	 * @generated
	 * @ordered
	 */
	protected CurrentFlow currentLimit3;

	/**
	 * The cached value of the '{@link #getInverseTimeFlag() <em>Inverse Time Flag</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getInverseTimeFlag()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean inverseTimeFlag;

	/**
	 * The cached value of the '{@link #getTimeDelay1() <em>Time Delay1</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeDelay1()
	 * @generated
	 * @ordered
	 */
	protected Seconds timeDelay1;

	/**
	 * The cached value of the '{@link #getTimeDelay2() <em>Time Delay2</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeDelay2()
	 * @generated
	 * @ordered
	 */
	protected Seconds timeDelay2;

	/**
	 * The cached value of the '{@link #getTimeDelay3() <em>Time Delay3</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimeDelay3()
	 * @generated
	 * @ordered
	 */
	protected Seconds timeDelay3;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CurrentRelayImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProtectionPackage.Literals.CURRENT_RELAY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CurrentFlow getCurrentLimit1() {
		if (currentLimit1 != null && currentLimit1.eIsProxy()) {
			InternalEObject oldCurrentLimit1 = (InternalEObject)currentLimit1;
			currentLimit1 = (CurrentFlow)eResolveProxy(oldCurrentLimit1);
			if (currentLimit1 != oldCurrentLimit1) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT1, oldCurrentLimit1, currentLimit1));
			}
		}
		return currentLimit1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CurrentFlow basicGetCurrentLimit1() {
		return currentLimit1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCurrentLimit1(CurrentFlow newCurrentLimit1) {
		CurrentFlow oldCurrentLimit1 = currentLimit1;
		currentLimit1 = newCurrentLimit1;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT1, oldCurrentLimit1, currentLimit1));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CurrentFlow getCurrentLimit2() {
		if (currentLimit2 != null && currentLimit2.eIsProxy()) {
			InternalEObject oldCurrentLimit2 = (InternalEObject)currentLimit2;
			currentLimit2 = (CurrentFlow)eResolveProxy(oldCurrentLimit2);
			if (currentLimit2 != oldCurrentLimit2) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT2, oldCurrentLimit2, currentLimit2));
			}
		}
		return currentLimit2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CurrentFlow basicGetCurrentLimit2() {
		return currentLimit2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCurrentLimit2(CurrentFlow newCurrentLimit2) {
		CurrentFlow oldCurrentLimit2 = currentLimit2;
		currentLimit2 = newCurrentLimit2;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT2, oldCurrentLimit2, currentLimit2));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CurrentFlow getCurrentLimit3() {
		if (currentLimit3 != null && currentLimit3.eIsProxy()) {
			InternalEObject oldCurrentLimit3 = (InternalEObject)currentLimit3;
			currentLimit3 = (CurrentFlow)eResolveProxy(oldCurrentLimit3);
			if (currentLimit3 != oldCurrentLimit3) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT3, oldCurrentLimit3, currentLimit3));
			}
		}
		return currentLimit3;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CurrentFlow basicGetCurrentLimit3() {
		return currentLimit3;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCurrentLimit3(CurrentFlow newCurrentLimit3) {
		CurrentFlow oldCurrentLimit3 = currentLimit3;
		currentLimit3 = newCurrentLimit3;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT3, oldCurrentLimit3, currentLimit3));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getInverseTimeFlag() {
		if (inverseTimeFlag != null && inverseTimeFlag.eIsProxy()) {
			InternalEObject oldInverseTimeFlag = (InternalEObject)inverseTimeFlag;
			inverseTimeFlag = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldInverseTimeFlag);
			if (inverseTimeFlag != oldInverseTimeFlag) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.CURRENT_RELAY__INVERSE_TIME_FLAG, oldInverseTimeFlag, inverseTimeFlag));
			}
		}
		return inverseTimeFlag;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetInverseTimeFlag() {
		return inverseTimeFlag;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInverseTimeFlag(EA_Model.IEC61970.Domain.Boolean newInverseTimeFlag) {
		EA_Model.IEC61970.Domain.Boolean oldInverseTimeFlag = inverseTimeFlag;
		inverseTimeFlag = newInverseTimeFlag;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.CURRENT_RELAY__INVERSE_TIME_FLAG, oldInverseTimeFlag, inverseTimeFlag));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds getTimeDelay1() {
		if (timeDelay1 != null && timeDelay1.eIsProxy()) {
			InternalEObject oldTimeDelay1 = (InternalEObject)timeDelay1;
			timeDelay1 = (Seconds)eResolveProxy(oldTimeDelay1);
			if (timeDelay1 != oldTimeDelay1) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.CURRENT_RELAY__TIME_DELAY1, oldTimeDelay1, timeDelay1));
			}
		}
		return timeDelay1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds basicGetTimeDelay1() {
		return timeDelay1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimeDelay1(Seconds newTimeDelay1) {
		Seconds oldTimeDelay1 = timeDelay1;
		timeDelay1 = newTimeDelay1;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.CURRENT_RELAY__TIME_DELAY1, oldTimeDelay1, timeDelay1));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds getTimeDelay2() {
		if (timeDelay2 != null && timeDelay2.eIsProxy()) {
			InternalEObject oldTimeDelay2 = (InternalEObject)timeDelay2;
			timeDelay2 = (Seconds)eResolveProxy(oldTimeDelay2);
			if (timeDelay2 != oldTimeDelay2) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.CURRENT_RELAY__TIME_DELAY2, oldTimeDelay2, timeDelay2));
			}
		}
		return timeDelay2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds basicGetTimeDelay2() {
		return timeDelay2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimeDelay2(Seconds newTimeDelay2) {
		Seconds oldTimeDelay2 = timeDelay2;
		timeDelay2 = newTimeDelay2;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.CURRENT_RELAY__TIME_DELAY2, oldTimeDelay2, timeDelay2));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds getTimeDelay3() {
		if (timeDelay3 != null && timeDelay3.eIsProxy()) {
			InternalEObject oldTimeDelay3 = (InternalEObject)timeDelay3;
			timeDelay3 = (Seconds)eResolveProxy(oldTimeDelay3);
			if (timeDelay3 != oldTimeDelay3) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProtectionPackage.CURRENT_RELAY__TIME_DELAY3, oldTimeDelay3, timeDelay3));
			}
		}
		return timeDelay3;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Seconds basicGetTimeDelay3() {
		return timeDelay3;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTimeDelay3(Seconds newTimeDelay3) {
		Seconds oldTimeDelay3 = timeDelay3;
		timeDelay3 = newTimeDelay3;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProtectionPackage.CURRENT_RELAY__TIME_DELAY3, oldTimeDelay3, timeDelay3));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT1:
				if (resolve) return getCurrentLimit1();
				return basicGetCurrentLimit1();
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT2:
				if (resolve) return getCurrentLimit2();
				return basicGetCurrentLimit2();
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT3:
				if (resolve) return getCurrentLimit3();
				return basicGetCurrentLimit3();
			case ProtectionPackage.CURRENT_RELAY__INVERSE_TIME_FLAG:
				if (resolve) return getInverseTimeFlag();
				return basicGetInverseTimeFlag();
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY1:
				if (resolve) return getTimeDelay1();
				return basicGetTimeDelay1();
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY2:
				if (resolve) return getTimeDelay2();
				return basicGetTimeDelay2();
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY3:
				if (resolve) return getTimeDelay3();
				return basicGetTimeDelay3();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT1:
				setCurrentLimit1((CurrentFlow)newValue);
				return;
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT2:
				setCurrentLimit2((CurrentFlow)newValue);
				return;
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT3:
				setCurrentLimit3((CurrentFlow)newValue);
				return;
			case ProtectionPackage.CURRENT_RELAY__INVERSE_TIME_FLAG:
				setInverseTimeFlag((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY1:
				setTimeDelay1((Seconds)newValue);
				return;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY2:
				setTimeDelay2((Seconds)newValue);
				return;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY3:
				setTimeDelay3((Seconds)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT1:
				setCurrentLimit1((CurrentFlow)null);
				return;
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT2:
				setCurrentLimit2((CurrentFlow)null);
				return;
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT3:
				setCurrentLimit3((CurrentFlow)null);
				return;
			case ProtectionPackage.CURRENT_RELAY__INVERSE_TIME_FLAG:
				setInverseTimeFlag((EA_Model.IEC61970.Domain.Boolean)null);
				return;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY1:
				setTimeDelay1((Seconds)null);
				return;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY2:
				setTimeDelay2((Seconds)null);
				return;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY3:
				setTimeDelay3((Seconds)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT1:
				return currentLimit1 != null;
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT2:
				return currentLimit2 != null;
			case ProtectionPackage.CURRENT_RELAY__CURRENT_LIMIT3:
				return currentLimit3 != null;
			case ProtectionPackage.CURRENT_RELAY__INVERSE_TIME_FLAG:
				return inverseTimeFlag != null;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY1:
				return timeDelay1 != null;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY2:
				return timeDelay2 != null;
			case ProtectionPackage.CURRENT_RELAY__TIME_DELAY3:
				return timeDelay3 != null;
		}
		return super.eIsSet(featureID);
	}

} //CurrentRelayImpl
